<style>
<!--
.top_li{
	float:right !important;
	line-height: 2em;
}
#creat_div , #user_id-label , #is_edit-label , #is_add-label{
	display:none;
}

-->
</style>
<table id="user_lst">
</table>

<script><!--
$(function() {
	window.grids = $("#user_lst").flexigrid({
		url: '<?php echo $this->pagePath;?>/msg',
		dataType: 'json',
		colModel : [
			{display: 'ID', name : 'id', width : 20, sortable : true, align: 'center'},
			{display: '类型', name : 'type', width : 50, sortable : true, align: 'left'},
			{display: '来自', name : 'from_user', width : 50, sortable : true, align: 'left'},			
			{display: '发给', name : 'to_user', width : 50, sortable : false, align: 'left'},
			{display: '状态', name : 'state', width : 50, sortable : true, align: 'left',process:getState},
			{display: '日程提醒', name : 'alarm_time', width : 80, sortable : true, align: 'left',process:getAlarm},
			{display: '消息', name : 'msg', width : 300, sortable : true, align: 'left'},
			{display: '创建时间', name : 'create_time', width : 80, sortable : true, align: 'left'}
			
		],
		searchitems : [
            {display: '消息内容' ,name : 'name', isdefault: true}
		],
		buttons : [
			<?php if($this->allow('add','user','')){?>
			{name: '系统消息',bclass:"edit", onpress :sysmsg},
			<?php } ?>
			<?php if($this->allow('add','user','')){?>
			{name: '操作日志',bclass:"edit", onpress :eventlog},
			<?php } ?>
			<?php if($this->allow('edit','user','')){?>
			{name: '站内信',bclass:"edit", onpress :usermsg},
			<?php } ?>
			<?php if($this->allow('delete','user','')){?>
			{name: '日程提醒',bclass:"edit", onpress :alarm},
			<?php } ?>
		], 
		sortname: "id",
		sortorder: "desc",
		//singleSelect:true,//是否单选
		usepager: true,
		hideOnSubmit:1,//禁用遮照
		title: '消息及日程列表',
		useRp: true,
		rp: 15,
		showTableToggleBtn: true,
		id:"accountsList",
		width: "99%",
		height: 310,
		onRowClick:function($e){
			bh = $e.find("[abbr='customer_bh'] div").html();
			//element.value = namer;
		},
		onRowDblclick:function(){
			//hideList();
		}
	}).show();
});
var getState = function(a,b){
	a.innerHTML = (a.innerHTML > 0)?"<font color='green'>已读</font>":"<font color='red'>未读</font>";
},
getAlarm = function(a,b){
	a.innerHTML = (a.innerHTML > 0)?"<font color='green'>ON</font>":"<font color='red'>OFF</font>";
},
sysmsg = function(){
	var data = {"type":0};
	window.grids.flexLoad({"params":data});
},
eventlog = function(){
	var data = {"type":1};
	window.grids.flexLoad({"params":data});
},
usermsg = function(){
	var data = {"type":2};
	window.grids.flexLoad({"params":data});
},
alarm = function(){
	var data = {"type":3};
	window.grids.flexLoad({"params":data});
}
--></script>
<div id="creat_div"></div>
<div id="edit_div"></div>